// packageD/member/myOrder/refund/components/returnReasonPop/returnReasonPop.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    popShow:{
      type:Boolean
    },
    reasonList:{
      value:[],
      type:Array
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    radio:0,
    otherText:""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    setPopShow(){
      this.setData({
        popShow:!this.data.popShow
      });
    },
    onChange(event) {
      this.setData({
        radio: event.detail,
      });
    },
    send(){
      let text=this.data.reasonList[this.data.radio];
      if((this.data.radio+1) == this.data.reasonList.length){
        text = this.data.otherText;
        if(this.data.otherText=="") {
          return wx.showToast({
            title: "请输入其他原因",
            icon: "error",
            duration: 2000,
          });
        }
      }
      this.setPopShow();
      this.triggerEvent('confirm',{text});
    }
  }
});
